<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>高阶函数</title>
</head>

<body>
    <script>
        var appendDiv = function (callback) {
            for (var i = 0; i < 100; i++) {
                var div = document.createElement('div'); div.innerHTML = i; document.body.appendChild(div);
                if (typeof callback === 'function') {
                    callback(div);
                }
            }
        };
        appendDiv(function(node){
            node.style.display = 'none';
        })
    </script>
</body>

</html>